package com.lxxin.service;

import com.lxxin.annotation.ClearRedisCache;
import com.lxxin.pojo.Message;
import com.lxxin.service.impl.UserServiceImpl;
import org.springframework.cache.annotation.Cacheable;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public interface MessageService {

    /**
     * 查询留言列表
     * @return
     */
    @Cacheable(cacheNames = "cache")
    List<Message> findMessageList(Integer currentPage, Integer pageSize);

    /**
     * 查询留言总数
     * @return
     */
    @Cacheable(cacheNames = "cache")
    Integer findMessageCount();

    /**
     * 保存留言信息
     * @param message
     * @param request
     * @return
     */
    @ClearRedisCache(cascade = UserServiceImpl.class)
    int saveMessage(Message message, HttpServletRequest request);
}
